package com.runchinaup.smartbelt.domian;

import android.text.format.Time;
import android.util.Log;

public class ElectricityAndTimeData extends BaseData {

    public byte[] getElectricityData() {
        return new byte[]{(byte) 0xa1, 0x5a, 0x04, 0x10, (byte) 0xf1};
    }

    //同步时间
    public byte[] synchronizationTime() {
        Time t = new Time();
        t.setToNow();
        int year = (t.year % 2000);
        int month = t.month;
        int day = t.monthDay;
        int hour = t.hour;
        int minutes = t.minute;
        int second = t.second;

        byte[] timeValue = new byte[]{
                (byte) 0xa1,
                0x5a,
                0x0a,
                0x06,
                (byte) year,
                (byte) month,
                (byte) day,
                (byte) hour,
                (byte) minutes,
                (byte) second,
                0};
        timeValue[timeValue.length - 1] = CountCheckCode(timeValue);
        Log.e("synchronizationTime: ", "同步时间");
        return timeValue;
    }


}
